// pages/collect/collect.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    zhuimanLists: wx.getStorageSync('zhuimanLists'),
  },
  navToDetail(event) {
    // console.log(event.currentTarget.dataset);
    wx.navigateTo({
      url: `/pages/detail/detail?id=${event.currentTarget.dataset.id}&title=${event.currentTarget.dataset.title}`,
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    wx.showLoading({
      title: '加载中',
    })
    wx.request({
      url: 'http://cloud.agopage.com/6b83fd3bc06260ec/agopageDetail?userInfoId=5fb186153f',
      data: {
        agopageId: this.data.zhuimanLists[0].id
      },
      success: (res) => {
        console.log(res);
        this.setData({
          detail: res.data.agopage,
        })
      },
      complete: () => {
        wx.hideLoading()
      }
    })
    wx.request({
      url: 'http://cloud.agopage.com/6b83fd3bc06260ec/agopageDetail?userInfoId=5fb186153f',
      data: {
        agopageId: this.data.zhuimanLists[1].id
      },
      success: (res) => {
        console.log(res);
        this.setData({
          detailo: res.data.agopage,
        })
      },
    })
    wx.request({
      url: 'http://cloud.agopage.com/6b83fd3bc06260ec/agopageDetail?userInfoId=5fb186153f',
      data: {
        agopageId: this.data.zhuimanLists[2].id
      },
      success: (res) => {
        console.log(res);
        this.setData({
          detailt: res.data.agopage,
        })
      },
    })
    wx.request({
      url: 'http://cloud.agopage.com/6b83fd3bc06260ec/agopageDetail?userInfoId=5fb186153f',
      data: {
        agopageId: this.data.zhuimanLists[3].id
      },
      success: (res) => {
        console.log(res);
        this.setData({
          details: res.data.agopage,
        })
      },
    })
    wx.request({
      url: 'http://cloud.agopage.com/6b83fd3bc06260ec/agopageDetail?userInfoId=5fb186153f',
      data: {
        agopageId: this.data.zhuimanLists[4].id
      },
      success: (res) => {
        console.log(res);
        this.setData({
          detailf: res.data.agopage,
        })
      },
    })
    wx.request({
      url: 'http://cloud.agopage.com/6b83fd3bc06260ec/agopageDetail?userInfoId=5fb186153f',
      data: {
        agopageId: this.data.zhuimanLists[5].id
      },
      success: (res) => {
        console.log(res);
        this.setData({
          detailw: res.data.agopage,
        })
      },
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },
  onRefresh:function(){
    //导航条加载动画
    wx.showNavigationBarLoading()
    //loading 提示框
    wx.showLoading({
      title: 'Loading...',
    })
    console.log("下拉刷新啦");
    setTimeout(function () {
      wx.hideLoading();
      wx.hideNavigationBarLoading();
      //停止下拉刷新
      wx.stopPullDownRefresh();
    }, 2000)
  },
  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {
    this.onRefresh();
    wx.request({
      url: 'http://cloud.agopage.com/6b83fd3bc06260ec/agopageDetail?userInfoId=5fb186153f',
      data: {
        agopageId: this.data.zhuimanLists[0].id
      },
      success: (res) => {
        console.log(res);
        this.setData({
          detail: res.data.agopage,
        })
      },
    })
    wx.request({
      url: 'http://cloud.agopage.com/6b83fd3bc06260ec/agopageDetail?userInfoId=5fb186153f',
      data: {
        agopageId: this.data.zhuimanLists[1].id
      },
      success: (res) => {
        console.log(res);
        this.setData({
          detailo: res.data.agopage,
        })
      },
    })
    wx.request({
      url: 'http://cloud.agopage.com/6b83fd3bc06260ec/agopageDetail?userInfoId=5fb186153f',
      data: {
        agopageId: this.data.zhuimanLists[2].id
      },
      success: (res) => {
        console.log(res);
        this.setData({
          detailt: res.data.agopage,
        })
      },
    })
    wx.request({
      url: 'http://cloud.agopage.com/6b83fd3bc06260ec/agopageDetail?userInfoId=5fb186153f',
      data: {
        agopageId: this.data.zhuimanLists[3].id
      },
      success: (res) => {
        console.log(res);
        this.setData({
          details: res.data.agopage,
        })
      },
    })
    wx.request({
      url: 'http://cloud.agopage.com/6b83fd3bc06260ec/agopageDetail?userInfoId=5fb186153f',
      data: {
        agopageId: this.data.zhuimanLists[4].id
      },
      success: (res) => {
        console.log(res);
        this.setData({
          detailf: res.data.agopage,
        })
      },
    })
    wx.request({
      url: 'http://cloud.agopage.com/6b83fd3bc06260ec/agopageDetail?userInfoId=5fb186153f',
      data: {
        agopageId: this.data.zhuimanLists[5].id
      },
      success: (res) => {
        console.log(res);
        this.setData({
          detailw: res.data.agopage,
        })
      },
    })
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})